package com.jic.market.service.coupon;

import com.jic.common.base.vo.Page;
import com.jic.common.base.vo.PageResult;
import com.jic.common.base.vo.RestResult;
import com.jic.market.entity.MarketCouponPeriodEntity;
import com.jic.market.entity.MarketDictEntity;
import com.jic.market.entity.coupon.CouponConfig;
import com.jic.market.request.*;
import com.jic.market.request.manager.base.MerchantDeleteRequest;
import com.jic.market.request.manager.base.PromotionIdRequest;
import com.jic.market.request.manager.base.StoreDeleteRequest;
import com.jic.market.request.manager.coupon.*;
import com.jic.market.request.rest.coupon.CouponReceiveOfPersonRequest;
import com.jic.market.request.rest.coupon.SendCouponRequest;
import com.jic.market.response.CouponConfigQueryResponse;
import com.jic.market.response.CouponDetailResponse;
import com.jic.market.response.CouponNumAndGrouponNumResponse;
import com.jic.market.response.manager.coupon.CouponCountResponse;
import com.jic.market.response.manager.coupon.CouponGoodsQueryResponse;
import com.jic.market.response.manager.coupon.CouponMerchantResponse;
import com.jic.market.response.manager.coupon.CouponStoreResponse;
import com.jic.market.response.manager.coupon.CouponTriggerQueryResponse;

import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

/**
 * 优惠券配置表
 *
 * @author : seven
 * @version : v1.0.0
 * @email : 774329481@qq.com
 * @since : 2020-03-15 08:18:04
 */
public interface CouponConfigService {

    long insert(CouponConfig couponConfig);

    long delete(String promotionId);

    long update(CouponConfig couponConfig);

    CouponConfig queryByPrimaryKey(Long id);

    List<CouponConfig> query(CouponConfig couponConfig);

    PageResult<CouponConfig> queryPage(CouponConfig couponConfig, Page pageQuery);

    public RestResult<PageResult<CouponConfigQueryResponse>> queryCouponConfigPage(CouponConfigQueryRequest couponConfigQueryRequest);

    public RestResult<CouponConfigQueryResponse> queryCouponConfig(PromotionIdRequest promotionIdRequest);

    public RestResult<String> addCouponConfig(CouponConfigAddRequest couponConfigAddRequest);

    public RestResult<Boolean> updateCouponConfig(CouponConfigUpdateRequest couponConfigUpdateRequest);

    public RestResult<String> copyCouponConfig(PromotionIdRequest promotionIdRequest,boolean templateFlag);

    public RestResult<Boolean> closeCouponConfig(PromotionIdRequest promotionIdRequest);

    public RestResult<Boolean> deleteCouponConfig(PromotionIdRequest promotionIdRequest);

    public RestResult<Boolean> addCouponMerchantConfig(CouponMerchantAddRequest couponMerchantAddRequest);

    public RestResult<CouponMerchantResponse> queryCouponMerchant(CouponDetailRequest promotionIdRequest);

    public RestResult<Boolean> deleteCouponMerchant(MerchantDeleteRequest merchantDeleteRequest);

    public RestResult<Boolean> addCouponStoreConfig(CouponStoreAddRequest couponStoreAddRequest);

    public RestResult<CouponStoreResponse> queryCouponStore(CouponDetailRequest promotionIdRequest);

    public RestResult<Boolean> deleteCouponStore(StoreDeleteRequest storeDeleteRequest);

    public RestResult<Boolean> checkCoupon(@RequestBody CouponCheckRequest couponCheckRequest);

    public RestResult<Boolean> addGoodsLimit(CouponGoodsLimitIdsAddRequest couponGoodsLimitAddRequest);

    public RestResult<CouponGoodsQueryResponse> queryGoodsId(PromotionIdRequest promotionIdRequest);

    public RestResult<Boolean> deleteCouponGoods(CouponGoodsDeleteRequest couponGoodsDeleteRequest);

    public RestResult<Boolean> deleteBatchGoods(CouponBatchDeleteRequest couponBatchDeleteRequest);

    public RestResult<Boolean> addTriggerLimit(CouponTriggerLimitAddRequest couponTriggerLimitAddRequest);

    public RestResult<Boolean> updateTriggerLimit(CouponTriggerLimitAddRequest couponTriggerLimitAddRequest);

    public RestResult<CouponTriggerQueryResponse> queryTrigger(PromotionIdRequest promotionIdRequest);

    public RestResult<Boolean> grantCoupon(CouponGrantRequest couponGrantRequest);

    public RestResult<PageResult<CouponDetailResponse>> queryCouponDetail(CouponDetailRequest couponDetailRequest);

    public RestResult<Boolean> updateGoodsLimit(CouponGoodsLimitAddRequest couponGoodsLimitAddRequest);

    public RestResult<Boolean> deleteCouponDetail(PromotionIdRequest promotionIdRequest);

    public RestResult<PageResult<CouponCountResponse>> queryCouponCount(CouponCountRequest couponCountRequest);

    public RestResult<String> saveTemplate(CouponTemplatRequest couponTemplatRequest);

    RestResult<Boolean> addAllGoods(CouponGoodsLimitIdsAddRequest couponGoodsLimitAddRequest);

    RestResult<List<Long>> getMerchantIdsByPromotionId(PromotionIdRequest promotionIdRequest);

    RestResult<List<Long>> getStoreIdsByPromotionId(PromotionIdRequest promotionIdRequest);

    RestResult<CouponGoodsQueryResponse> queryRedGoodsByPromotionId(PromotionIdRequest promotionIdRequest);

    RestResult<List<Long>> getCouponStoreIdsByPromotionId(PromotionIdRequest promotionIdRequest);

    RestResult<PageResult<CouponConfigQueryResponse>> queryRedMutexDetailPromotionList(PromotionIdRequest promotionIdRequest);

    RestResult<Map<String, Object>> rendRedAdd(CouponGoodsLimitAddRequest couponGoodsLimitAddRequest);

    PageResult<CouponConfigQueryResponse>  getCouponList(CouponConfigQueryRequest couponConfigQueryRequest);

    /**
     * 批量发送优惠券
     * @param couponReceiveOfPersonRequest
     * @return
     */
    RestResult<Boolean> sendCoupon(SendCouponRequest couponReceiveOfPersonRequest);

    CouponConfigQueryResponse getCouponByPromotionId(CouponConfigQueryRequest couponConfigQueryRequest);

    RestResult<Long> backstageSendCoupon(BackstageSendCouponRequest request);

    RestResult<PageResult<MarketCouponPeriodEntity>> queryCouponPeriod(PromotionIdRequest request);

    RestResult<Long> getCouponIssuableTotal(PromotionIdRequest request);

    RestResult<Integer> queryPeriodStatusById(QueryPeriodStatusByIdRequest request);

    RestResult<CouponNumAndGrouponNumResponse> queryMyCouponNumberAndGrouponNumber(CouponNumAndGrouponNumRequest request);
}